import { EnumStatusCode } from "@shared/constant/enum";
import express, { Request, Response } from "express";

const errorMiddleWare = (err: any, req: Request, res: Response) => {
  console.error("服务器错误:", err);
  res.status(EnumStatusCode.INTERNAL_SERVER_ERROR).json({
    code: EnumStatusCode.INTERNAL_SERVER_ERROR,
    message: "服务器内部错误",
    data: null,
  });
};

export { errorMiddleWare };
